home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-02-10 | 2.6 KB | 90 lines | [TEXT/MPS ] |
- {--------------------------------------------------------------------------------------------------}
-
- {$S TInit}
-
- PROCEDURE TSingleSegSA.ISingleSegSA(aFile: FileSpec;
- mainType: ResType;
- mainID: Integer;
- mainName: StringHandle);
-
- BEGIN
- IMultiSegSA(aFile, mainType, mainID, mainName, kDfltOtherSeg);
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- {$S TRes}
-
- PROCEDURE TSingleSegSA.CalcSegTableSize(theCount: Integer; hasCtorDtorJT: Boolean); OVERRIDE;
-
- VAR
- tempSize: LongInt;
-
- BEGIN
- tempSize := 8; { single segment standalone has only one segment; so it's 4 + 4}
- ShowNumericalProgress('Segment table size = ', tempSize);
- fSegTabSize := tempSize;
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- {$S TRes}
- { We're concerned with all CODE resources since they }
- { will be merged into the standalone code resources. The only }
- { exceptions being CODE 0 and the static Ctor and Dtor jump tables}
- { which hide in a special CODE resource. }
-
- FUNCTION TSingleSegSA.WillBeMerged(theID: Integer; theName: Str255): Boolean; OVERRIDE;
-
- BEGIN
- IF (theID <> 0) AND (theName <> kCtorDtorSeg ) THEN { We are only concerned with CODE 1 }
- WillBeMerged := TRUE
- ELSE
- WillBeMerged := FALSE;
- END;
-
- {--------------------------------------------------------------------------------------------------}
-
- {$S TRes}
-
- PROCEDURE TSingleSegSA.MergeCodeSegments(saCode: Handle; VAR saPos: LongInt); OVERRIDE;
-
- VAR
- theCode: Handle;
- theCount: Integer;
- theID: Integer;
- theType: ResType;
- theName: Str255;
- theSize: LongInt;
- i: Integer;
-
- BEGIN
- INHERITED MergeCodeSegments(saCode, saPos);
-
- theCount := Count1Resources('CODE');
- IF (theCount <= 0) THEN Failure(resNotFound, 0);
-
- { Get the remaining CODE segments. However, watch out for special segments! }
- FOR i := 1 TO theCount DO
- BEGIN
- theCode := NIL;
- theCode := Get1IndResource('CODE', i);
- FailNilResource(theCode);
- theSize := SizeResource(theCode);
- GetResInfo(theCode, theID, theType, theName);
-
- { Watch out for the main jump table or the CtorDtor jump table }
- IF (theID <> 1) AND WillBeMerged(theID, theName) THEN
- BEGIN
- Merge1Segment(theID, theCode, theSize, saCode, saPos);
- NumToString(theID, theName);
- theName := concat('Code ', theName, ' ends at: ');
- ShowNumericalProgress(theName, saPos);
- END;
-
- ReleaseResource(theCode);
- END;
- END;
-
- {--------------------------------------------------------------------------------------------------}
-